Image encoding method/device, image decoding method/device, and recording medium in which bitstream is stored

ABSTRACT

The present invention provides an image encoding method and an image decoding method. The image encoding method of the present invention comprises: a first dividing step of dividing a current image into a plurality of blocks; and a second dividing step of dividing, into a plurality of sub blocks, a block, which is to be divided and includes a boundary of the current image, among the plurality of blocks, wherein the second dividing step is recursively performed by setting a sub block including the boundary of the current images as the block to be divided, until the sub block including the boundary of the current image does not exist among the sub blocks.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a Continuation Application of a currently pendingU.S. patent application Ser. No. 17/818,650, filed on Aug. 9, 2022,which is a Continuation of application Ser. No. 17/328,273, filed on May24, 2021, now Granted U.S. Pat. No. 11,659,178, issued May 23, 2023,which is a Continuation of application Ser. No. 16/341,792, filed onApr. 12, 2019, now Granted U.S. Pat. No. 11,057,624, issued Jul. 6,2021, which is a U.S. National Stage Application of InternationalApplication No. PCT/KR2017/011213, filed on Oct. 12, 2017, which claimsthe benefit under 35 USC 119(a) and 365(b) of Korean Patent ApplicationNo. 10-2016-0133754, filed on Oct. 14, 2016, Korean Patent ApplicationNo. 10-2016-0133757, filed on Oct. 14, 2016, Korean Patent ApplicationNo. 10-2017-0127939, filed on Sep. 29, 2017, and Korean PatentApplication No. 10-2017-0127942, filed on Sep. 29, 2017, in the KoreanIntellectual Property Office, the entire disclosures of which areincorporated herein by reference for all purposes.

TECHNICAL FIELD

The present invention relates to an image encoding/decoding method andapparatus and particularly to a method and apparatus for processingimage boundaries in image encoding/decoding. More particularly, thepresent invention relates to a method and apparatus for effectivelyprocessing image boundaries in an image padding and tree structure.

BACKGROUND ART

In recent years, demand for multimedia data such as video has beenrapidly increasing on the Internet. However, it is hard for developmentof technology for improving channel bandwidths to keep up with the rapidchanges in the demand for multimedia data. In order to solve thisproblem, Moving Picture Expert Group (MPEG) of ISO/IEC and Video CodingExpert Group (VCEG) of ITU-T, which is the International Organizationfor Standardization, are continuously collaborating to establishimproved compression standards.

Video compression consists largely of intra prediction, inter-pictureprediction, transform, quantization, entropy coding, and an in-loopfilter. Among them, the intra prediction is a technique of generating aprediction block for a current block by using reconstructed pixelsexisting around the current block. In this case, since the encodingprocess is performed on a per block basis so that the size of the imagehas to be a multiple of the size of the block, there is a problem thatit is difficult to perform encoding on a per block basis.

DISCLOSURE Technical Problem

An object of the present invention is to provide an imageencoding/decoding method and an image encoding/decoding apparatuscapable of improving compression efficiency in image encoding/decoding.

It is another object of the present invention to provide a paddingmethod and apparatus for adjusting the size of an image on a per blockbasis in image encoding/decoding.

It is another object of the present invention to provide an imagepartitioning method and apparatus which is efficient for image boundaryprocessing in image coding decoding.

It is another object of the present invention to provide an imageencoding/decoding method and an image encoding/decoding apparatuscapable of improving compression efficiency by efficiently usinginformation of neighboring blocks when encoding/decoding a current blockin image encoding/decoding.

It is another object of the present invention to provide acomputer-readable recording medium storing a bitstream generated by avideo encoding method/apparatus according to the present invention.

Technical Solution

An image encoding method according to the present invention includes afirst partition step of partitioning a current image into a plurality ofblocks; and a second partition step of partitioning a partition targetblock including a boundary of the current image among the plurality ofblocks, into a plurality of sub-blocks, wherein, until a sub-blockincluding the boundary of the current image does not exist among thesub-blocks, the second partition step is recursively performed bysetting the sub-block including the boundary of the current images asthe partition target block.

In the image encoding method according to the present invention, thefirst partition step may partition the current image into a plurality oflargest blocks having the same size.

In the image encoding method according to the present invention, thesecond partition step may perform quad tree partitioning or binary treepartitioning on the partition target block.

In the image encoding method according to the present invention, whenthe partition target block has a size in which the quad treepartitioning is possible, the second partition step may perform the quadtree partitioning on the partition target block, and when the partitiontarget block has a size in which the quad tree partitioning is notpossible, the second partition step may perform the binary treepartitioning on the partition target block.

In the image encoding method according to the present invention, whenthe quad tree partitioning or the binary tree partitioning is performedon the partition target block in the second partition step, firstpartition information indicating whether the partition target block isquad tree partitioned or second partition information indicating whetherthe partition target block is binary tree partitioned may be not encoded

In the image encoding method according to the present invention, whenthe binary tree partitioning is performed on the partition target blockin the second partition step, a partition direction of the binary treepartitioning may be determined on the basis of a type of an encodingtarget block that is included in the partition target block and is anarea in a boundary of the current image.

In the image encoding method according to the present invention, whenthe binary tree partitioning is performed on the partition target blockin the second partition step, partition direction information indicatinga partition direction of the binary tree partition may be not encoded.

In the image encoding method according to the present invention, thesecond partition step may further include comparing a size of aremaining area that is included in the partition target block and is anarea outside the boundary of the current image with a predeterminedthreshold value, and one of the quad tree partitioning and the binarytree partitioning may be performed on the partition target block on thebasis of the comparison result.

In the image encoding method according to the present invention, thesize of the remaining area may be a smaller one of a horizontal lengthand a vertical length of the remaining area, and the second partitionstep may perform the quad tree partitioning on the partition targetblock when the size of the remaining area is greater than thepredetermined threshold value, and perform the binary tree partitioningon the partition target block when the size of the remaining area issmaller than the predetermined threshold value.

In the image encoding method according to the present invention, thesecond partition step may perform binary tree partitioning on thepartition target block, and a partition direction of the binary treepartitioning may be determined on the basis of a type of a remainingarea that is included in the partition target block and is an areaoutside the boundary of the current image.

In the image encoding method according to the present invention, thepartition direction of the binary tree partitioning may be vertical whenthe type of the remaining area is a vertically long block, and may behorizontal when the type of the remaining area is a horizontally longblock.

An image decoding method according to the present invention includes afirst partition step of partitioning a current image into a plurality ofblocks; and a second partition step of partitioning a partition targetblock including a boundary of the current image among the plurality ofblocks, into a plurality of sub-blocks, wherein, until a sub-blockincluding the boundary of the current image does not exist among thesub-blocks, the second partition step is recursively performed bysetting the sub-block including the boundary of the current images asthe partition target block.

In the image decoding method according to the present invention, thesecond partition step may perform quad tree partitioning or binary treepartitioning on the partition target block.

In the image decoding method according to the present invention, whenthe partition target block has a size in which the quad treepartitioning is possible, the second partition step may perform the quadtree partitioning on the partition target block, and when the partitiontarget block has a size in which the quad tree partitioning is notpossible, the second partition step may perform the binary treepartitioning on the partition target block.

In the image decoding method according to the present invention, whenthe quad tree partitioning or the binary tree partitioning is performedon the partition target block in the second partition step, firstpartition information indicating whether the partition target block isquad tree partitioned or second partition information indicating whetherthe partition target block is binary tree partitioned may not be decodedfrom a bitstream but derived into a predetermined value.

In the image decoding method according to the present invention, whenthe binary tree partitioning is performed on the partition target blockin the second partition step, a partition direction of the binary treepartitioning may be determined on the basis of a type of an decodingtarget block that is included in the partition target block and is anarea in a boundary of the current image.

In the image decoding method according to the present invention, whenthe binary tree partitioning is performed on the partition target blockin the second partition step, partition direction information indicatinga partition direction of the binary tree partition may not be decodedfrom a bitstream but derived into a predetermined value.

In the image decoding method according to the present invention, thesecond partition step may further include comparing a size of aremaining area that is included in the partition target block and is anarea outside the boundary of the current image with a predeterminedthreshold value, and one of the quad tree partitioning and the binarytree partitioning may be performed on the partition target block on thebasis of the comparison result.

In the image decoding method according to the present invention, thesize of the remaining area may be a smaller one of a horizontal lengthand a vertical length of the remaining area, and the second partitionstep may perform the quad tree partitioning on the partition targetblock when the size of the remaining area is greater than thepredetermined threshold value, and perform the binary tree partitioningon the partition target block when the size of the remaining area issmaller than the predetermined threshold value.

In the image decoding method according to the present invention, thesecond partition step may perform binary tree partitioning on thepartition target block, and a partition direction of the binary treepartitioning may be determined on the basis of a type of a remainingarea that is included in the partition target block and is an areaoutside the boundary of the current image.

In the image decoding method according to the present invention, thepartition direction of the binary tree partitioning may be vertical whenthe type of the remaining area is a vertically long block, and may behorizontal when the type of the remaining area is a horizontally longblock.

An image decoding method according to the present invention includesdetermining a partition type of an upper level block including a currentblock; constructing a reference candidate list of the current block onthe basis of the partition type of the upper level block; derivingprediction information for the current block on the basis of thereference candidate list; and generating a prediction block of thecurrent block on the basis of the prediction information, wherein thereference candidate list includes prediction information of at least onecandidate block or the at least one candidate block, and the at leastone candidate block is included in the reference candidate listaccording to a predetermined priority.

The image decoding method according to the present invention, the methodmay further include comparing the partition depth of the immediatelypreceding block of the current block and the partition depth of thecurrent block in the decoding order when the partition type of the upperblock is a binary tree partition; and determining whether or not theupper block of the previous block and the upper block of the currentblock are the same, wherein when the partition depth of the immediatelypreceding block and the partition depth of the current block are thesame, and the upper block of the block is the same, the immediatelypreceding block may be excluded from the at least one candidate block.

In the image decoding method according to the present invention, whenthe immediately preceding block is excluded from the at least onecandidate block, the method may further include including a substituteblock in the reference candidate list.

In the image decoding method according to the present invention, thesubstitute block may be a block that is not adjacent to the currentblock among blocks partitioned from the upper level block of the currentblock.

In the image decoding method according to the present invention, whenthe current block is intra predicted, the reference candidate list is anMPM list, and when the current block is inter predicted, the referencecandidate list may be a candidate list including a spatial candidatelist.

In the image decoding method according to the present invention, themethod may further include determining whether the current block is thelast sub-block in the decoding order among the four sub-blocks generatedby quad tree partitioning when the partition type of the upper levelblock is quad tree partitioning, and determining whether the remainingthree sub-blocks except the current block among the four sub-blocks havethe same prediction information when the current block is the lastsub-block, wherein when the three sub-blocks have the same predictioninformation, the remaining three sub-blocks may be excluded from the atleast one candidate block.

In the image decoding method according to the present invention, the atleast one candidate block may be included in the reference candidatelist according to a predetermined priority.

In the image decoding method according to the present invention, thepriority may be determined on the basis of at least one of whether thecurrent block is adjacent to the candidate block and the position of thecandidate block.

In the image decoding method according to the present invention, acandidate block adjacent to the current block may have a higher prioritythan a candidate block not adjacent to the current block

In the image decoding method according to the present invention, acandidate block located at the left or top of the current block may havea higher priority than other candidate blocks.

In the image decoding method according to the present invention, thepriority may be determined on the basis of at least one of a partitiondepth of the current block and a partition depth of the candidate block.

In the image decoding method according to the present invention, thesmaller the difference between the partition depth of the current blockand the partition depth of the candidate block, the higher the priority.

In the image decoding method according to the present invention, acandidate block having a large partition depth may have a higherpriority than a candidate block having a small partition depth.

In the image decoding method according to the present invention, thepriority may be determined on the basis of a partition order of thecandidate blocks.

In the image decoding method according to the present invention, acandidate block having a fast partition order may have a higher prioritythan a candidate block having a slow partition order.

In the image decoding method according to the present invention, thepriority order may be determined on the basis of the relationship ofprediction information between the candidate blocks.

In the image decoding method according to the present invention, whenthe prediction information of the first candidate block among thecandidate blocks is determined on the basis of the predictioninformation of the second candidate block among the candidate blocks,the first candidate block may have a lower priority than the candidateblock.

An image encoding method according to the present invention includesderiving prediction information for a current block, generatingprediction block of the current block on the basis of the predictioninformation, determining a partition type of an upper level blockincluding the current block, constructing a reference candidate list ofthe current block on the basis of the partition type of the upper block,and encoding the prediction information for the current block on thebasis of the reference candidate list, wherein the reference candidatelist may include at least one candidate block or prediction informationof the at least one candidate block.

In the image encoding method according to the present invention, themethod may further include comparing the partition depth of theimmediately preceding block of the current block and the partition depthof the current block in the coding order when the partition type of theupper block is the binary tree partition, and determining whether or notthe upper block of the previous block and the upper block of the currentblock are the same, wherein the dividing depth of the immediatelypreceding block and the dividing depth of the current block are thesame, Wherein the immediately preceding block is excluded from the atleast one candidate block when the upper level block of the block is thesame.

In the image encoding method according to the present invention, whenthe partition type of the upper level block is quad tree partitioning,the current block is the last sub-block in the coding order out of thefour sub-blocks generated by quad tree partitioning and determiningwhether the remaining three sub-blocks except the current block amongthe four sub-blocks have the same prediction information when thecurrent block is the last sub-block, when the three sub-blocks have thesame prediction information, the remaining three sub-blocks may beexcluded from the at least one candidate block.

In the image encoding method according to the present invention, the atleast one candidate block may be included in the reference candidatelist according to a predetermined priority.

In the image encoding method according to the present invention, thepriority may be determined on the basis of at least one of whether thecurrent block is adjacent to the candidate block and the position of thecandidate block.

In the image coding method according to the present invention, thepriority may be determined on the basis of at least one of a partitiondepth of the current block and a partition depth of the candidate block.

In the image encoding method according to the present invention, thepriority order may be determined on the basis of the partition order ofthe candidate blocks.

In the image encoding method according to the present invention, thepriority may be determined on the basis of the relationship ofprediction information between the candidate blocks.

The computer readable recording medium according to the presentinvention may store a bit stream generated by the image encoding methodaccording to the present invention.

Advantageous Effects

According to the present invention, it is possible to provide an imageencoding/decoding method and an image encoding/decoding apparatuscapable of improving compression efficiency in image encoding/decoding.

In addition, according to the present invention, it is possible toprovide a padding method and apparatus for adjusting the size of animage on a per block basis in image encoding/decoding.

In addition, according to the present invention, it is possible toprovide an image partitioning method and apparatus which is efficientfor image boundary processing in image coding decoding.

In addition, according to the present invention, it is possible toprovide an image encoding/decoding method and an image encoding/decodingapparatus capable of improving compression efficiency by efficientlyusing information of neighboring blocks when encoding/decoding a currentblock in image encoding/decoding.

In addition, according to the present invention, it is possible toprovide a computer-readable recording medium storing a bitstreamgenerated by a video encoding method/apparatus according to the presentinvention.

The compression efficiency of the image may be improved using thepadding method and apparatus or the block partitioning method andapparatus according to the present invention.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram schematically illustrating an image encodingapparatus according to an embodiment of the present invention.

FIG. 2 is a view showing types of intra prediction modes defined in theimage encoding/decoding apparatus.

FIG. 3 is a view illustrating an intra prediction method based on aplanar mode.

FIG. 4 is a view illustrating reference pixels for intra prediction.

FIG. 5 is a view illustrating an intra prediction method based on ahorizontal mode and a vertical mode.

FIG. 6 is a schematic block diagram of a video decoding apparatusaccording to an embodiment of the present invention.

FIG. 7 is a view illustrating a padding process according to anembodiment of the present invention.

FIGS. 8 a and 8 b are views illustrating a padding process according tothe present invention.

FIG. 9 is a view illustrating an operation of the image partitioningunit 101 of FIG. 1 .

FIG. 10 is a view illustrating an operation in the decoder according tothe present invention.

FIG. 11 is a view illustrating a case where the size of the currentimage is not a multiple of a size of largest block.

FIGS. 12 a to 12 e are diagrams illustrating an image partitioningmethod according to an embodiment of the present invention.

FIGS. 13 a to 13 e are diagrams illustrating an image partitioningmethod according to another embodiment of the present invention.

FIG. 14 is a view illustrating a method of generating a motioninformation candidate group in the case of a skip mode and a merge mode.

FIG. 15 is a view illustrating a method of deriving a motion informationcandidate group for motion estimation in an AMVP mode.

FIG. 16 is a view illustrating positions of spatial candidate blocks andtemporal candidate blocks in the current block.

FIG. 17 is a view illustrating a method of determining motioninformation of a temporal candidate.

FIG. 18 is an exemplary table illustrating a priority of a combinationcapable of being used to generate bidirectional motion informationcandidates.

FIG. 19 is a view illustrating generation of an MPM candidate list.

FIG. 20 is a view illustrating a method of encoding the optimalprediction information of skip mode, merge mode, AMVP mode, and intraprediction mode.

FIG. 21 is a view illustrating a method of decoding optimal predictioninformation.

FIG. 22 is a view illustrating an embodiment of constructing a referencecandidate list using neighboring blocks of the current block.

FIG. 23 is a view illustrating an example of constructing a referencecandidate list of a current block on the basis of a partition type of ablock.

FIG. 24 is a view illustrating another embodiment for constructing areference candidate list using neighboring blocks of the current block.

FIG. 25 is a view illustrating another embodiment for constructing areference candidate list of a current block on the basis of a partitiontype of a block.

FIG. 26 is a view illustrating a method of changing the priority ofneighboring blocks of the current block included in the referencecandidate list.

FIG. 27 is a view illustrating a method of determining priority ofneighboring blocks on the basis of the partition depth.

FIG. 28 is a view illustrating a method of determining priority ofneighboring blocks on the basis of a partitioning order.

FIG. 29 is a view illustrating a method of determining the priority ofneighboring blocks on the basis of casual relationship of predictioninformation.

FIG. 30 is a view illustrating a method of determining the priority ofneighboring blocks considering both the partition depth and thepartitioning order.

MODE FOR INVENTION

While the invention is susceptible to various modifications andalternative forms, specific embodiments thereof are shown by way ofexample in the drawings and will herein be described in detail. Itshould be understood, however, that the invention is not intended to belimited to the particular embodiments, but includes all modifications,equivalents, and alternatives falling within the spirit and scope of theinvention. Like reference numerals are used for like elements indescribing each drawing.

Terms such as first, second, A, B, and the like may be used to describevarious components, but the components should not be limited by theseterms. The terms are used only for the purpose of distinguishing onecomponent from another. For example, without departing from the scope ofthe present invention, the first component may be referred to as asecond component, and similarly, the second component may also bereferred to as a first component. The term “and/or” includes anycombination of a plurality of related listed items or any of a pluralityof related listed items.

It is to be understood that when an element is referred to as being“connected” or “coupled” to another element, it may be directlyconnected or coupled to the other component, but it should be understoodthat other components may be present between them. On the other hand,when an element is referred to as being “directly connected” or“directly coupled” to another element, it should be understood thatthere are no other elements between them.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention.The singular forms include plural referents unless the context clearlydictates otherwise. In this application, the terms “comprising” or“having”, etc., are used to specify that there is a stated feature,figure, step, operation, element, part or combination thereof, but donot preclude the presence or addition of one or more other features,integers, steps, operations, components, parts, or combinations thereof.

Hereinafter, embodiments of the present invention will be described indetail with reference to the accompanying drawings. Hereinafter, thesame reference numerals will be used for the same constituent elementsin the drawings, and redundant explanations for the same constituentelements will be omitted.

FIG. 1 is a block diagram schematically illustrating an image encodingapparatus according to an embodiment of the present invention.

Referring to FIG. 1 , an image encoding apparatus 100 includes an imagepartition unit 101, an intra prediction unit 102, an inter predictionunit 103, a subtractor 104, a transformation unit 105, a quantizationunit 106, an entropy encoding unit 107, an dequantization unit 108, aninverse transformation unit 109, an adder 110, a filter unit 111, and amemory 112.

The respective components shown in FIG. 1 are shown independently torepresent different characteristic functions in the image encodingapparatus, and do not mean that each of the components is composed of aseparate hardware or a single software constituent unit. That is, eachcomponent is listed and included for convenience of explanation, and atleast two components of components units may be combined to form onecomponent, or one component may be divided into a plurality ofcomponents to perform a function. The integrated embodiments andseparate embodiments of the components are also included within thescope of the present invention, without departing from the essence ofthe present invention.

Furthermore, some components are not essential components that performessential functions in the present invention, but may be optionalcomponents only for improving performance. The present invention may beimplemented including only components essential for realizing theessence of the present invention except for the components used forperformance improvement, and only components essential for realizing theessence of the present invention except for the components used forperformance improvement are also included in the scope of the presentinvention.

The image partition unit 101 may partition an input image into at leastone block. Here, the input image may have various shapes and sizes suchas a picture, a slice, a tile, a segment, and the like. A block may meana coding unit (CU), a prediction unit (PU), or a transform unit (TU).The partitioning may be performed on the basis of at least one of a quadtree or a binary tree. The quad tree is a method of quad-partitioning anupper level block into sub-blocks whose width and height are half of theupper level block. A binary tree is a method of bi-partitioning an upperblock into sub-blocks in which any one of width or height is half of theupper level block. Through the binary tree-based partitioning describedabove, a block may have a non-square shape as well as a square shape.

Hereinafter, in the embodiment of the present invention, a coding unitmay mean a unit for performing encoding and may mean a unit forperforming decoding.

The prediction units 102 and 103 may include an intra prediction unit103 for performing inter prediction and an intra prediction unit 102 forperforming intra prediction. It is possible to determine whether to useinter prediction or intra prediction for a prediction unit and todetermine specific information (for example, intra prediction mode,motion vector, reference picture, etc.) according to each predictionmethod. Here, the processing unit in which the prediction is performedmay be different from the processing unit in which the prediction methodand the concrete contents are determined. For example, the predictionmethod, the prediction mode, and the like are determined by a predictionunit, and the prediction may be performed by a transform unit.

The residual value (residual block) between the generated predictionblock and the original block may be input to the transformation unit105. In addition, prediction mode information, motion vectorinformation, and the like used for prediction may be encoded in theentropy encoding unit 107 together with the residual value, and thentransmitted to the decoder. When a specific encoding mode is used, theoriginal block may be encoded as it is without generating the predictionblock through the prediction units 102 and 103 and transmitted to thedecoding unit.

The intra prediction unit 102 may generate a prediction block on thebasis of reference pixel information around the current block, which ispixel information in a current picture. When the prediction mode of theneighboring block of the current block on which intra prediction is tobe performed is inter prediction, a reference pixel included in aneighboring block to which inter prediction is applied may besubstituted with a reference pixel in another neighboring block to whichintra prediction is applied. In other words, when the reference pixel isnot available, it is possible to substitute the unavailable referencepixel information with at least one of the available reference pixels.

In intra prediction, the prediction mode may have a directionalprediction mode in which reference pixel information is used accordingto a prediction direction, and a non-directional mode in whichprediction information is not used upon performing prediction. The modefor predicting the luminance information may be different from the modefor predicting the chrominance information, and the intra predictionmode information used for predicting the luminance information orpredicted luminance signal information may be utilized in order topredict the chrominance information.

The intra prediction unit 102 may include an adaptive intra smoothing(AIS) filter, a reference pixel interpolator, and a DC filter. The AISfilter is a filter that performs filtering on the reference pixels ofthe current block, and may adaptively determine whether to apply thefilter according to the prediction mode of the current prediction unit.When the prediction mode of the current block is a mode that does notperform AIS filtering, the AIS filter may not be applied.

The reference pixel interpolator of the intra prediction unit 102 mayinterpolate the reference pixel to generate a reference pixel in theposition of a fractional unit, when an intra prediction mode of aprediction unit is a prediction unit performing intra prediction on thebasis of a pixel value obtained by interpolating a reference pixel. Thereference pixel may not be interpolated, when the prediction mode of thecurrent prediction unit generates a prediction block withoutinterpolating the reference pixel. The DC filter may generate theprediction block through filtering when the prediction mode of thecurrent block is DC mode.

A residual block including residual information, which is a differencevalue between the prediction unit generated in the prediction units 102and 103 and the original block of the prediction unit, may be generated.The generated residual block may be input to the transformation unit 130and then transformed.

FIG. 2 is a view showing an example of intra prediction mode. The intraprediction mode shown in FIG. 2 has a total of 35 modes. A mode 0represents a planar mode, a mode 1 represents a DC mode, and modes 2 to34 represent angular modes.

FIG. 3 is a view illustrating an intra prediction method based on aplanar mode.

FIG. 3 is a view illustrating a planar mode. A prediction value of thefirst pixel P1 in the current block is generated by linearlyinterpolating the reconstructed pixel located at the same position inthe Y axis and the reconstructed pixel T located at the upper right ofthe current block as shown. Likewise, a prediction value of the secondpixel P2 a is generated by linearly interpolating the reconstructedpixel located at the same position in the X axis and a reconstructedpixel L located at the lower left of the current block as shown. A valueobtained by averaging two prediction pixels P1 and P2 becomes a finalprediction pixel. In the planar mode, prediction pixels are derived inthe same manner as described above to generate the prediction block ofthe current block.

FIG. 4 is a view illustrating a DC mode. The average of thereconstructed pixels around the current block is calculated, and thenthe average value is used as the prediction value of all the pixels inthe current block.

FIG. 5 is a view illustrating an example of generating a predictionblock using mode 10 (horizontal mode) and mode 26 (vertical mode) inFIG. 2 . In the case of using mode 10, each reference pixel adjacent tothe left of the current block is copied rightward to generate aprediction block of the current block. Similarly, in the case of mode26, each reference block adjacent to the top of the current block iscopied downward to generate a prediction block of the current block.

Referring back to FIG. 1 , the inter prediction unit 103 may predict aprediction unit on the basis of information of at least one of aprevious picture and a following picture of the current picture, andalso may be predict a prediction unit on the basis of the information ofthe partially encoded area in the current picture. The inter predictionunit 103 may include a reference picture interpolation unit, a motionprediction unit, and a motion compensation unit.

The reference picture interpolation unit may generate receives referencepicture information from the memory 112 and generates pixel informationof integer pixels or sub-pixels from the reference picture. In the caseof a luminance pixel, a DCT-based 8-tap interpolation filter havingdifferent filter coefficients may be used to generate pixel informationon sub-pixels on a per ¼-pixel basis. In the case of a chrominancepixel, a DCT-based 4-tap interpolation filter having different filtercoefficients may be used to generate pixel information on sub-pixels ona per ⅛-pixel basis.

The motion prediction unit performs motion prediction on the basis of areference picture interpolated by a reference picture interpolationunit. Various methods such as full search-based block matching algorithm(FBMA), three step search (TSS), and new three-step search algorithm(NTS) may be used to calculate motion vectors. The motion vector has amotion vector value per ½-pixel or ¼-pixel, on the basis of theinterpolated pixel. In the motion prediction unit, the currentprediction unit may be predicted by using different motion predictionmethods. Various methods such as a skip method, a merge method, anadvanced motion vector prediction (AMVP) method, and the like may beused as the motion prediction method.

The subtractor 104 generates a residual block of the current block bysubtracting the prediction block generated by the intra prediction unit102 or the inter-picture prediction unit 103 from the current encodingtarget block.

In the transformation unit 105, a transform block may be generated bytransforming a residual block, which is a difference between an originalblock and a prediction block. The transform block may be the smallestunit in which the transform and quantization process is performed. Thetransformation unit 105 may transform the residual signal into thefrequency domain to generate a transform block including the transformcoefficients. A transform method such as Discrete Cosine Transform(DCT), Discrete Sine Transform (DST), Karhunen-Loeve Transform (KLT),and the like may be used to transform the residual block including theresidual data into the frequency domain. The transform coefficients maybe generated by transforming the residual signal into the frequencydomain using the transform method. Matrix operations using a basisvector may be performed to easily perform the transformation. Dependingon which prediction mode the prediction block is encoded in, thetransformation methods may be used in various ways when performing amatrix operation. For example, the transform method may be determined onthe basis of the intra prediction mode of the prediction unit used togenerate the residual block. For example, DCT may be used for thehorizontal direction, and DST may be used for the vertical direction,depending on the intra prediction mode.

The quantization unit 106 may quantize the values transformed into thefrequency domain by the transformation unit 105. That is, thequantization unit 106 may quantize transform coefficients of thetransform block generated from the transformation unit 105 to generate aquantized transform block having the quantized transform coefficients.As the quantization method, dead zone uniform threshold quantization(DZUTQ) or a quantization weighted matrix may be used. Alternatively,various quantization methods such as an improved quantization method maybe used. The quantization coefficient may vary depending on the block orthe importance of the image. The values calculated by the quantizationunit 106 may be provided to a dequantization unit 108 and an entropyencoding unit 107.

The transformation unit 105 and/or the quantization unit 106 may beoptionally included in the image encoding apparatus 100. That is, theimage encoding apparatus 100 may perform at least one of transformationor quantization on the residual data of the residual block, or skip boththe transformation and the quantization, thereby encoding the residualblock. In the image encoding apparatus 100A, even when any one oftransform and quantization is not performed, or both transform andquantization are not performed, a block received as an input of theentropy encoding unit 107 is typically referred to as a transform block.

The entropy encoding unit 107 entropy-encodes the input data. Theentropy encoding unit 107 may encode the quantized transform block tooutput a bitstream. That is, the entropy encoding unit 107 may encodethe quantized transform coefficients of the quantized transform blockoutput from the quantization unit 106 using various encoding techniquessuch as entropy encoding. Further, the entropy encoding unit 107 mayencode additional information (e.g., prediction mode information,quantization coefficient, etc.) required for decoding the correspondingblock in the image decoding apparatus described later. For entropyencoding, various encoding methods such as exponential-Golomb,context-adaptive variable length coding (CAVLC), and context-adaptivebinary arithmetic coding (CABAC) may be used.

The entropy encoding unit 107 may encode a variety of information, suchas residual coefficient information and block type information,prediction mode information, partition unit information, prediction unitinformation, transmission unit information, motion vector information,prediction frame information, block interpolation information, andfiltering information of the encoding unit from the prediction units 102and 103. In the entropy encoding unit 107, coefficients of the transformblock are encoded on the basis of various types of flags indicating anon-zero coefficient, a coefficient whose absolute value is 1 or greaterthan 2 in units of a partial block in the transform block, a sign of thecoefficient, and the like. The coefficient not encoded with only theflags may be encoded through the absolute value of a difference betweenthe coefficient encoded through the flag and the coefficient of theactual transform block. The dequantization unit 108 and the inversetransformation unit 109 dequantizes values quantized by the quantizationunit 106 and inverts values transformed by the transformation unit 105.The residual value generated in the dequantization unit 108 and theinverse transformation unit 109 is summed with a prediction unitpredicted through a motion predictor, a motion compensator, and an intraprediction unit 102, which are included in the prediction units 102 and103, thereby generating reconstructed block. The adder 110 adds theprediction blocks generated by the prediction units 102 and 103 and theresidual blocks generated through the inverse transformation unit 109 togenerate reconstructed blocks.

The filter unit 111 may include at least one of a deblocking filter, anoffset correction unit, and an adaptive loop filter (ALF).

The deblocking filter may remove the block distortion caused by theboundary between the blocks in the reconstructed picture. It may bedetermined whether or not a deblocking filter is applied to a currentblock on the basis of pixels included in several columns or rowsincluded in the block to determine whether to perform deblocking. Whenthe deblocking filter is applied to a block, a strong filter or a weakfilter may be applied according to the deblocking filtering strengthrequired. In applying the deblocking filter, horizontal filtering andvertical filtering may be performed concurrently in performing verticalfiltering and horizontal filtering.

The offset correction unit may correct the offset between the deblockedimage and the original image on a per pixel basis. In order to performoffset correction for a specific picture, pixels included in an imageare divided into a predetermined number of areas, an area on whichoffset is performed is then determined, and an offset is performed onthe area. Alternatively, the offset may be applied to edge informationof each pixel.

Adaptive loop filtering (ALF) may be performed on the basis of a valueobtained by comparing the filtered reconstructed image with the originalimage. After dividing the pixels included in the image into apredetermined number of pixel groups, one filter to be applied to eachgroup may be determined and filtering may be performed differently foreach group. The information on whether to apply the ALF is provided suchthat luminance signal may be transmitted for each coding unit (CU), andthe shape and the filter coefficient of the ALF filter to be applied maybe varied according to each block. Also, the ALF of the same type (fixedtype) may be applied irrespective of characteristics of the targetblocks to be filtered.

The memory 112 may store a reconstructed block or picture calculatedthrough the filter unit 111, and the reconstructed block or picture maybe provided to the prediction units 102 and 103 when inter prediction isperformed.

The intra prediction unit 102 and the inter prediction unit 103 may becollectively referred to as a prediction unit. The prediction unit maygenerate a prediction block using the neighboring pixels of the currentblock or the reference picture that has been already decoded. Aprediction block may generate one or more prediction blocks in thecurrent block. When there is only one prediction block in the currentblock, the prediction block may have the same shape as the currentblock. When a prediction block is generated, a residual blockcorresponding to a difference between the current block and theprediction block may be generated. By applying various techniques suchas rate-distortion optimization (RDO) to the generated residual block,the optimal prediction mode may be determined. For example, thefollowing equation 1 may be used for the calculation of RDO.

J(Ø,λ)=D(Ø)+λR(Ø)  [Equation 1]

In Equation 1, D( ), R( ), and J( ) denote the deterioration due toquantization, the rate of the compressed stream, and the RD cost,respectively. Φ denotes an encoding mode. λ is a Lagrangian multiplierand is used as a scale correction coefficient for matching the unitsbetween error amount and bit amount. In order to be selected as theoptimal encoding mode in the encoding process, the J( ), that is, the RDcost when the corresponding mode is applied, must be smaller than thatwhen the other modes are applied. A bit rate and error may be consideredsimultaneously when calculating the RD cost.

FIG. 6 is a block diagram illustrating a video decoding apparatus 600according to an embodiment of the present invention.

Referring to FIG. 6 , an image decoding apparatus 600 includes anentropy decoding unit 601, a dequantization unit 602, an inversetransformation unit 603, an adding unit 604, a filter unit 605, a memory606, and prediction units 607 and 608.

When the image bit stream generated by the image encoding apparatus 100is input to the image decoding apparatus 600, the input bit stream isdecoded according to a process opposite to that performed by the imageencoding apparatus 100.

The entropy decoding unit 601 performs entropy decoding in a procedureopposite to that in which entropy encoding is performed in the entropyencoding unit 107 of the image encoding apparatus 100. For example,various methods such as exponential-Golomb, context-adaptive variablelength coding (CAVLC), and context-adaptive binary arithmetic coding(CABAC) may be applied in accordance with the method performed by theimage encoder. The entropy decoding unit 601 decodes coefficients of thetransform block on the basis of a value other than 0, a coefficienthaving an absolute value greater than 1 or 2 for each partial blockwithin the transform block, and various types of flags indicating a signof the coefficient. The coefficient not represented with only the flagsmay be decoded by summing a coefficient represented by a flag and asignaled coefficient.

The entropy decoding unit 601 may decode information related to intraprediction and inter prediction performed in the encoder.

The dequantization unit 602 performs dequantization on the quantizedtransform block to generate a transform block and operates substantiallythe same as the dequantization unit 108 of FIG. 1 .

The inverse transformation unit 603 performs inverse transform on thetransform block to generate a residual block. Here, the transform methodmay be determined on the basis of information on a prediction method(inter or intra prediction), size and/or type of a block, intraprediction mode, and the like and operates substantially the same as theinverse transformation unit 109 of FIG. 1 .

The adder 604 adds the prediction block generated in the intraprediction unit 607 or the inter prediction unit 608 and the residualblock generated through the inverse transformation unit 603 to generatea reconstruction block and operates substantially the same as the adder110 of FIG. 1 .

The filter unit 605 reduces various types of noise occurring in thereconstructed blocks.

The filter unit 605 may include a deblocking filter, an offsetcorrection unit, and an ALF.

When information on whether or not a deblocking filter is applied to acorresponding block or picture from the image encoding apparatus 100 anda deblocking filter are applied, information on whether a strong filteror a weak filter is applied is received. The deblocking filter of theimage decoding apparatus 600 receives the deblocking filter relatedinformation provided by the image encoding apparatus 100, and the imagedecoding apparatus 600 performs deblocking filtering on thecorresponding block.

The offset correction unit performs offset correction on thereconstructed image on the basis of the type and offset valueinformation of the offset correction applied to the image whenperforming encoding.

The ALF may be applied to a coding unit on the basis of information onwhether to apply ALF, ALF coefficient information, and the like providedfrom the image encoding apparatus 100. Such ALF information may beincluded in a specific set of parameters. The filter unit 605 operatessubstantially the same as the filter unit 111 of FIG. 1 .

The memory 606 stores reconstructed blocks generated by the adder 604and operates substantially the same as the memory 112 of FIG. 1 .

The prediction units 607 and 608 may generate a prediction block on thebasis of the prediction block generation related information provided bythe entropy decoding unit 601 and the previously decoded block orpicture information provided by the memory 606.

The prediction units 607 and 608 may include an intra prediction unit607 and an inter prediction unit 608. Although not shown separately, theprediction units 607 and 608 may further include a prediction unitdiscriminator. The prediction unit discriminator receives variousinformation such as prediction unit information input from the entropydecoding unit 601, prediction mode information of the intra predictionmethod, motion prediction related information of the inter predictionmethod, identifies a prediction unit from the current coding unit, anddiscriminate whether the prediction unit performs inter prediction orintra prediction. The inter prediction unit 608 uses the informationrequired for inter prediction of the current prediction unit provided bythe image encoding apparatus 100 to perform inter prediction for thecurrent prediction unit on the basis of information included in at leastone of the previous picture or the following picture of the currentpicture including the current prediction unit. Alternatively, interprediction is performed on the basis of information of a partial areathat has been already reconstructed within the current picture includingthe current prediction unit.

In order to perform inter prediction, it is determined which method of askip mode, a merge mode, and an AMVP mode is used, as a motionprediction method of a prediction unit included in the correspondingcoding unit on the basis of an coding unit.

The intra prediction unit 607 generates a prediction block usingreconstructed pixels located around the current block to be encoded.

The intra prediction unit 607 may include an adaptive intra smoothing(AIS) filter, a reference pixel interpolator, and a DC filter. The AISfilter is a filter that performs filtering on the reference pixels ofthe current block, and may adaptively determine whether to apply thefilter according to the prediction mode of the current prediction unit.The AIS filtering may be performed on the reference pixel of the currentblock using the prediction mode of the prediction unit provided in theimage encoding apparatus 100 and the AIS filter information. When theprediction mode of the current block is a mode that does not perform AISfiltering, the AIS filter may not be applied.

The reference pixel interpolator of the intra prediction unit 607interpolates a reference pixel to generate a reference pixel at aposition of a fractional unit, when the prediction mode of theprediction unit is a prediction unit performing intra prediction on thebasis of a pixel value obtained by interpolating a reference pixel. Thegenerated reference pixel at the fractional unit position may be used asa prediction pixel of the pixel in the current block. The referencepixel may not be interpolated, when the prediction mode of the currentprediction unit is a prediction mode generating a prediction blockwithout interpolating the reference pixel. The DC filter may generate aprediction block through filtering when the prediction mode of thecurrent block is DC mode.

The intra prediction unit 607 operates substantially the same as theintra prediction unit 102 of FIG. 1 .

The inter prediction unit 608 generates an inter prediction block usingthe reference picture and the motion information stored in the memory606. The inter prediction unit 608 operates substantially the same asthe inter prediction unit 103 of FIG. 1 .

The present invention particularly relates to boundary processing ofpadding and image, and various embodiments of the present invention willbe described in more detail below with reference to the drawings.

According to an embodiment of the present invention, a preprocessingprocess may be performed before encoding target image is input to theimage partition unit 101 of FIG. 1 . The encoding target image may havevarious horizontal and vertical lengths of a pixel unit. However, sincethe encoding and decoding of an image are performed in any block unitrather than a pixel unit, a padding process may be required to adjustthe size of the encoding target image on a per-block basis.

FIG. 7 is a view illustrating a padding process according to anembodiment of the present invention.

In the example shown in FIG. 7 , the encoding target image includes ablock area and a non-block area. The preprocessing process is performedon the encoding target image, so that a padded area may be added. Theencoding target image to which the padded area is added may be input tothe image partition unit 101 of FIG. 1 .

In the example shown in FIG. 7 , the smallest block unit may be 4×4. Thehorizontal or vertical length of the block may be 2^(n). Thus, forexample, when the horizontal and vertical lengths of the encoding targetimage is 9 and the length of the encoding target image is 9respectively, one column in right and one row in the bottom of theencoding target image may be non-block areas not included in the blockarea. In this manner, when the encoding target image includes anon-block area, padding may be performed in consideration of the size ofthe smallest block. Thus, by performing the padding considering the sizeof the block, the padded encoding target image does not include thenon-block area. The padded encoding target image is input to the imagepartition unit 101 of FIG. 1 and is partitioned into a plurality ofblocks, so that encoding may be performed on a per block basis.

FIGS. 8 a and 8 b are views illustrating a padding process according tothe present invention.

First, padding may be performed in the horizontal direction using thepixel closest to the pixel to be padded. In the example shown in FIG. 8a , the three padding target pixels in the most top may be padded usingthe pixel A of the non-block area adjacent to the left.

After that, padding may be performed in the vertical direction using thepixel closest to the pixel to be padded. In the example shown in FIG. 8b , three padding target pixels in the leftmost area may be padded usingthe pixel I of the non-block area adjacent to the top.

In the above example, the padding process from the horizontal directionto the vertical direction has been described. However, the presentinvention is not limited to this, and padding from the verticaldirection to the horizontal direction may be performed. The size of thesmallest block may be a block unit or a sub-block unit to be describedwith reference to FIG. 9 .

FIG. 9 is a view illustrating the operation of the image partition unit101 of FIG. 1 .

The input image may be partitioned into a plurality of largest blocks.The size of the largest block may be predefined or signaled through thebitstream. For example, when the size of the input image is 128×128 andthe size of the largest block is 64×64, the input image may bepartitioned into four largest blocks.

Each largest block is input to the image partition unit 101 of FIG. 1and may be partitioned into a plurality of blocks. The input image maynot be partitioned into a plurality of largest blocks but may bedirectly input to the image partition unit 101. The minimum size of apartitioned block and/or the maximum size of the block that may bepartitioned into sub-blocks may be preset or may be signaled from theupper level header of the block. The upper level may be at least one ofa video, a sequence, a picture, a slice, a tile, and a largest codingunit (LCU).

The current block may be partitioned into four sub-blocks or twosub-blocks.

The partitioning of the current block into four sub-blocks may bereferred to as quad-tree partitioning. The current block may bepartitioned into four sub-blocks of the same size using quad treepartitioning. The first partition information is information indicatingwhether or not the quad tree partitioning is performed for the currentblock. The first partition information may be, for example, a flag of 1bit.

The partitioning of a current block into two sub-blocks may be referredto as binary tree partitioning. The current block may be partitionedinto two sub-blocks of the same or different size by binary treepartitioning. The second partition information is information indicatingwhether or not to perform binary tree partitioning on the current block.The second partition information may be, for example, a flag of 1 bit.When the current block is partitioned by binary tree, the partitiondirection information may be further signaled. The partition directioninformation may indicate whether the partitioning of the current blockis performed in a horizontal direction or in a vertical direction. Thepartition direction information may be, for example, a flag of 1 bit.When the current block is partitioned into two sub-blocks with differentsizes, the partition type information may be further signaled. Thepartition type information may indicate a partition ratio of twosub-blocks.

The current block may be recursively partitioned using quad treepartitioning and binary tree partitioning. For example, when the currentblock is partitioned into four sub-blocks by quad tree partitioning,each sub-block may be recursively quad tree partitioned, binary treepartitioned, or not partitioned. When the current block is partitionedinto two sub-blocks by binary tree partitioning, each sub-block may berecursively quad tree partitioned, binary tree partitioned, or notpartitioned. Alternatively, quad tree partitioning may not be performedon sub-blocks generated by binary tree partitioning.

The encoder may determine whether or not to perform quad treepartitioning on the input current block. The first partition informationmay be encoded on the basis of the determination (S901). When thecurrent block is quad tree partitioned (Yes in S902), the current blockmay be quad tree partitioned into four blocks (S903). Each of the fourblocks generated using the quad tree partition may be inputted again tothe step S901 in a predetermined order (S904 and S916). Thepredetermined order may be a Z-scan order. In step S904, the first blockaccording to the predetermined order among the four blocks is specifiedand input as the current block in step S901.

When the current block is not partitioned using the quad tree (No inS902), the encoder determines whether or not to perform binary treepartitioning on current block. The second partition information isencoded on the basis of the determination (S905). When the current blockis partitioned using binary tree partitioning (Yes in S906), the encoderdetermines whether to partition the current block horizontally orvertically, and encodes the partition direction information on the basisof the determination (S907). When the current block is partitionedhorizontally (Yes in S908), the horizontal partitioning for the currentblock may be performed (S909). Otherwise (No in S908), the verticalpartition for the current block may be performed (S910). When the binarytree partition type for the current block is an asymmetric partition,the partition ratio is determined and partition type information may befurther encoded. In this case, steps S909 and S910 may be performed inconsideration of the partition type information. Each of the twosub-blocks generated by binary tree partitioning may be input to thestep S905 again according to a predetermined order (S911 and S914). Thepredetermined order may be left to right, or top to bottom. In stepS911, the first sub-block according to the predetermined order among thetwo sub-blocks is specified and input as the current block in step S905.When the quad tree partition is allowed again for the sub-blockgenerated by binary tree partitioning, each of the two blocks generatedby binary tree partitioning may be input to step S901 according to apredetermined order.

When the current block is not binary tree partitioned (No in S906),encoding may be performed on the current block or the current sub-block(S912). The encoding in step S912 may include prediction, transform,quantization, and the like.

When the sub-block encoded in step S912 is not the last sub-blockgenerated by the binary tree partition (No in step S913), the nextsub-block generated by the binary tree partition is specified and inputas a current block to step S905 (S914).

When the sub-block encoded in step S912 is the last sub-block generatedby the binary tree partition (Yes in S913), whether the block to whichthe encoded sub-block belongs is the last block among the blockgenerated by quad tree partitioning is determined (S915). When it is thelast block (Yes in S915), the encoding for the largest block or thecurrent image input to step S901 may be ended. When it is not the lastblock (No in S915), the next block generated by quad tree partitioningis specified and may be input as a current block to step S901 (S916).

FIG. 10 is a view illustrating operations in a decoder according to thepresent invention.

The decoder may decode the first partition information of the inputcurrent block (S1001). When the current block is quad tree partitioned(Yes in S1002), the current block may be partitioned into four blocksusing quad tree partitioning (S1003). Each of the four blocks generatedby quad tree partitioning may be input again to the step S1001 accordingto a predetermined order (S1004, S1016). The predetermined order may bea Z-scan order. In step S1004, the first block according to thepredetermined order among the four blocks is specified and input as acurrent block to step S1001.

When the current block is not partitioned using quad tree partitioning(No in S1002), the decoder may decode the second partition informationof the current block (S1005). When the current block is binary treepartitioned (Yes in S1006), the decoder may decode the partitiondirection information (S1007). When the current block is partitionedhorizontally (Yes in S1008), the horizontal partitioning may beperformed on the current block (S1009). Otherwise (No in S1008), thevertical partitioning may be performed on the current block (S1010).When the binary tree partition type for the current block is anasymmetric partition, the partition type information may be furtherdecoded. In this case, steps S1009 and S1010 may be performed inconsideration of the partition type information. Each of the twosub-blocks generated by binary tree partitioning may be input again tostep S1005 according to a predetermined order (S1011, S1014). Thepredetermined order may be left to right, or top to bottom. In stepS1011, the first sub-block according to the predetermined order amongthe two sub-blocks is specified and input as a current block to stepS1005. When the quad tree partition is allowed again for the sub-blockgenerated by the binary tree partition, each of the two blocks generatedby the binary tree partition may be input to step S1001 according to apredetermined order.

When the current block is not binary tree partitioned (No in S1006),decoding may be performed (S1012) on the current block or the currentsub-block. The decoding in step S1012 may include prediction,dequantization, inverse transform, and the like.

When the sub-block decoded in step S1012 is not the last sub-blockgenerated by binary tree partitioning (No in step S1013), the nextsub-block generated by binary tree partitioning is specified and inputas a current block to step S1005 (S1014).

When the sub-block decoded in step S1012 is the last sub-block generatedby binary tree partitioning (Yes in S1013), whether the block to whichthe decoded sub-block belongs is the last block among the blocksgenerated by quad tree partitioning is determined (S1015). When it isthe last block (Yes in S1015), the decoding for the largest block or thecurrent image input in the step S1001 may be ended. When it is not thelast block (No in S1015), the next block generated by quad treepartitioning is specified and input as a current block to step S1001(S1016).

FIG. 11 is a view illustrating a case where the size of the currentimage is not a multiple of the largest block size.

As shown in FIG. 11 , when the current image is partitioned into aplurality of largest blocks, an area corresponding to a part of thelargest block size is left on the right or bottom of the current image.That is, in the case of the largest block 2, the largest block 5, thelargest block 6, the largest block 7, or the largest block 8, pixels ofthe current image exist only in the partial area.

Hereinafter, the image partitioning method according to the presentinvention by which the current image is efficiently partitioned as shownin FIG. 11 will be described.

FIGS. 12 a to 12 e are views illustrating an image partition methodaccording to an embodiment of the present invention. Hereinafter,referring to FIGS. 12 a to 12 e , the partitioning method and/or thepartition information encoding of the largest block 2 in FIG. 11 will bedescribed. In the following description referring to FIGS. 12 a to 12 e, it is assumed that the current image size is 146×146, the largestblock size is 64×64, the minimum size of a block that may be quad treepartitioned is 16×16, and the minimum size of a sub-block is 2×2.

FIG. 12 a is an enlarged view of the largest block 2, in which a portionsurrounded by a thick line is an area in the current image. The largestblock 2 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 a , the rightmost position and thebottommost position of the largest block 2 are not completely includedin the area of the current image. Also, the size of the largest block 2is 64×64, which is a size in which quad tree partitioning is possible.In this case, the largest block 2 may be quad tree partitioned (S903).That is, step S901 for the largest block 2 may be omitted. Then,partitioning and encoding for the block A0, which is the first blockamong the four blocks (A0, A1, A2, and A3) generated by quad treepartitioning of the largest block 2, may be performed. Since the blockA1 and the block A3 are not completely included in the area of thecurrent image, partitioning and encoding may be omitted. The block A2may be partitioned and encoded according to the present invention likethe block A0.

FIG. 12 b is an enlarged view of the block A0 in FIG. 12 a , and aportion surrounded by a thick line is an area in the current image. Theblock A0 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 b , the rightmost position B1 and thebottommost position B3 of the block A0 are not completely included inthe area of the current image. In addition, the size of the block A0 is32×32, which is a size in which quad tree partitioning is possible. Inthis case, the block A0 may be quad tree partitioned (S903). That is,step S901 for block A0 may be omitted. Then, the partitioning andencoding of the block B0 which is the first block among the four blocksB0, B1, B2 and B3 generated by quad tree partitioning of the block A0may be performed. The block B0 may be partitioned and encoded by themethod described with reference to FIG. 9 . That is, block B0 may beencoded without being partitioned or with being partitioned by quad treepartitioning and/or binary tree partitioning. The block B2 may bepartitioned and encoded according to the present invention like theblock B0. Since the block B1 and the block B3 are not completelyincluded in the area of the current image, partitioning and encoding maybe omitted. The block B2 may be partitioned and encoded in the samemanner as block B0. That is, step S901 cannot be omitted for the blockB0 and the block B2. However, for blocks B1 and B3, step S901 may beomitted as described later.

FIG. 12 c is an enlarged view of the block B1 in FIG. 12 b , in which aportion surrounded by a thick line is an area in the current image. Theblock B1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12C, the rightmost position and the bottommostposition of the block B1 are not completely included in the area of thecurrent image. In addition, the size of the block B1 is 16×16, which isa size in which quad tree partitioning is impossible. In this case, theblock B1 may not be quad tree partitioned, but may be binary treepartitioned. Further, since the encoding target block is a verticallylong rectangle, the partition direction may be determined to be avertical direction. Therefore, steps S901 to S907 may be omitted for theblock B1, and the binary tree partitioning in step S909 or S910 may beperformed according to the shape of the encoding target block.Thereafter, the partition and coding for the block C1, which is thefirst one of the two blocks C1 and C2 generated by the binary treepartitioning of the block B1, may be performed. Since the block C2 isnot completely included in the area of the current image, partitioningand encoding may be omitted.

FIG. 12 d is an enlarged view of the block C1 of FIG. 12 c , in which aportion surrounded by a thick line is an area in the current image. Theblock C1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 d , the rightmost position and thebottommost position of the block C1 are not completely included in thearea of the current image. In addition, since the binary treepartitioning is applied to the upper block B1 of the block C1, the blockC1 may also be binary tree partitioned. Further, since the encodingtarget block is a vertically long rectangle, the partition direction maybe determined to be the vertical direction. Therefore, steps S905 toS907 may be omitted for the block C1, and the binary tree partitioningof step S909 or S910 may be performed according to the shape of theencoding target block. Thereafter, partitioning and encoding for thefirst block, i.e., block D1, of the two blocks D1 and D2 generated bythe binary tree partitioning of the block C1 may be performed. Since theblock D2 is not completely included in the area of the current image,partitioning and encoding may be omitted.

FIG. 12 e is an enlarged view of the block D1 in FIG. 12 d , in which aportion surrounded by a thick line is an area in the current image. Theblock D1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 e , the rightmost position and thebottommost position of the block D1 are not completely included in thearea of the current image. In addition, since the binary treepartitioning is applied to C1, which is the upper level block of theblock D1, the block D1 may also be binary tree partitioned. Further,since the encoding target block is a vertically long rectangle, thepartition direction may be determined to be the vertical direction.Therefore, steps S905 to S907 may be omitted for the block D1, and thebinary tree partitioning of step S909 or S910 may be performed accordingto the shape of the encoding target block. Thereafter, partitioning andencoding for the first block E1 and the block E1 generated by the binarytree partitioning of the block D1 may be performed. The width of blockE1 is equal to 2, which is assumed to be the minimum size of thesub-block. Therefore, the vertical partitioning may not be performed onthe block E1. That is, the block E1 may be encoded without beingpartitioned, or may be horizontally partitioned and then encoded. Inthis case, for the block E1, only information on whether to performpartitioning may be signaled. Since the block E2 is not completelyincluded in the area of the current image, partitioning and encoding maybe omitted.

The partition information omission scheme of the largest block 2 and thelargest block 5 shown in FIG. 11 may be the same. In addition, thepartition information omission scheme of the largest block 6 and thelargest block 7 may be the same as the partition information omissionscheme of the largest block 2 and the largest block 5, except for adifference between the horizontal or vertical direction. For the largestblock 8, partition information omission may be performed in the samemanner as other largest blocks by using the reference presethorizontally or vertically.

Hereinafter, with reference to FIGS. 12 a to 12 e , description will bemade on the partitioning of the largest block 2 and/or the decoding ofthe partition information of FIG. 11 .

FIG. 12 a is an enlarged view of the largest block 2, in which a portionsurrounded by a thick line is an area in the current image. The largestblock 2 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 a , the rightmost position and thebottommost position of the largest block 2 are not completely includedin the area of the current image. Also, the size of the largest block 2is 64×64, which is a size in which quad tree partitioning is possible.In this case, the largest block 2 may be quad tree partitioned (S1003).That is, step S1001 for the largest block 2 may be omitted. Then,partitioning and decoding for the block A0, which is the first blockamong the four blocks A0, A1, A2, and A3 generated by the quad treepartitioning of the largest block 2, may be performed. Since the blockA1 and the block A3 are not completely included in the area of thecurrent image, partitioning and decoding may be omitted. The block A2may be partitioned and decoded according to the present invention likethe block A0.

FIG. 12 b is an enlarged view of the block A0 in FIG. 12 a , in which aportion surrounded by a thick line is an area in the current image. Theblock A0 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 b , the rightmost position and thebottommost position of the block A0 are not completely included in thearea of the current image. In addition, the size of the block A0 is32×32, which is a size in which quad tree partitioning is possible. Inthis case, the block A0 may be quad tree partitioned (S1003). That is,step S1001 for block A0 may be omitted. Thereafter, partitioning anddecoding of the first block, that is, block B0, among the four blocksB0, B1, B2, and B3 generated by the quad tree partitioning of the blockA0 may be performed. The block B0 may be partitioned and decoded in themanner described with reference to FIG. 9 . That is, the block B0 may bedecoded without being partitioned or with being partitioned by quad treepartition and/or binary tree partition. The block B2 may be partitionedand decoded according to the present invention similarly as the blockB0. Since block B1 and block B3 are not completely included in the areaof the current image, partitioning and decoding may be omitted. Theblock B2 may be partitioned and decoded in the same manner as the blockB0. That is, step S1001 may not be omitted for the block B0 and theblock B2. However, for blocks B1 and B3, step S1001 may be omitted aswill be described later.

FIG. 12 c is an enlarged view of the block B1 in FIG. 12 b , in which aportion surrounded by a thick line is an area in the current image. Theblock B1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 c , the rightmost position and thebottommost position of the block B1 are not completely included in thearea of the current image. In addition, the size of the block B1 is16×16, which is a size in which quad tree partitioning is impossible. Inthis case, the block B1 may not be quad tree partitioned, but may bebinary tree partitioned. Also, since the decoding target block is avertically long rectangle, the partition direction may be determined tobe the vertical direction. Accordingly, steps S1001 to S1007 may beomitted for the block B1, and the binary tree partitioning of step S1009or S1010 may be performed according to the shape of the decoding targetblock. Thereafter, partitioning and decoding may be performed on theblock C1, which is the first block of the two blocks C1 and C2 generatedby the binary tree partitioning of the block B1. Since the block C2 isnot completely contained in the area of the current image, partitioningand decoding may be omitted.

FIG. 12 d is an enlarged view of the block C1 of FIG. 12 c , in which aportion surrounded by a thick line is an area in the current image. Theblock C1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 d , the rightmost position and thebottommost position of the block C1 are not completely included in thearea of the current image. In addition, since the binary tree partitionis applied to the upper level block B1 of the block C1, the block C1 mayalso be binary tree partitioned. Also, since the decoding target blockis a vertically long rectangle, the partition direction may bedetermined to be the vertical direction. Therefore, steps S1005 to S1007may be omitted for block C1, and the binary tree partition of step S1009or S1010 may be performed according to the shape of the decoding targetblock. Thereafter, partitioning and decoding may be performed on blockD1, which is the first block among the two blocks D1 and D2 generated bythe binary tree partitioning of the block C1. Since the block D2 is notcompletely included in the area of the current image, partitioning anddecoding may be omitted.

FIG. 12 e is an enlarged view of the block D1 of FIG. 12 d , in which aportion surrounded by a thick line is an area in the current image. Theblock D1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 12 e , the rightmost position and thebottommost position of the block D1 are not completely included in thearea of the current image. In addition, since the binary tree partitionis applied to the upper level block C1 of the block D1, the block D1 mayalso be binary tree partitioned. Also, since the decoding target blockis a vertically long rectangle, the partition direction may bedetermined to be the vertical direction. Therefore, steps S1005 to S1007may be omitted for the block D1, and the binary tree partitioning ofstep S1009 or S1010 may be performed according to the shape of thedecoding target block. Thereafter, partitioning and decoding may beperformed on the block E1, which is the first block among the two blocksE1 and E2 generated by the binary tree partitioning of the block D1. Thewidth of block E1 is equal to 2, which is assumed to be the minimum sizeof the sub-block. Therefore, the vertical partition may not be performedfor the block E1. That is, the block E1 may be decoded without beingpartitioned or may be horizontally partitioned and then decoded. In thiscase, for the block E1, only information on whether to performpartitioning may be signaled. Since the block E2 is not completelyincluded in the area of the current image, partitioning and decoding maybe omitted.

In the embodiment described with reference to FIG. 12 , when quad treepartitioning is performed on a partition target block and apredetermined condition is satisfied, the binary tree partitioning maybe performed. In the above embodiment, whether or not the size of thepartition target block is a size in which quad tree partitioning ispossible is corresponding to the predetermined condition. Thepredetermined condition may be set using minimum sizes of a block inwhich the quad tree partition is possible and a block in which thebinary tree partition is possible and/or a threshold value.

When the threshold value is used, one of quad tree partitioning andbinary tree partitioning is performed on the basis of a result ofcomparing the threshold value with a size of an area (hereinafter,referred to “remaining area”) not completely included in the currentimage of the partition target block. In the following description, it isassumed that the threshold value is 32.

For example, in FIG. 12 a , the size of the encoding target block is18×64, and the size of the remaining area is 46×64. Since the remainingarea is a vertically long rectangle, the horizontal length of theremaining area may be compared with the threshold value. The horizontallength of the remaining area is 46, which is larger than the thresholdvalue of 32, so that quad tree partitioning may be performed on a 64×64partition target block. In FIG. 12B, since the horizontal length of theremaining area is 14, which is smaller than the threshold value of 32,binary tree partitioning may be performed on a 32×32 partition targetblock. That is, even when the size of the partition target block is asize in which quad tree partitioning is possible, binary treepartitioning may be performed instead of quad tree partitioningaccording to the above conditions. In this case, the partition directionof the binary tree partitioning is based on the smaller one of the widthand height of the 18×32 encoding target block. Thus, the block A0 inFIG. 12 b may be partitioned into two vertically long 16×32 blocks.After this, the binary tree partitioning in the vertical direction maybe repeatedly performed until the size of the block become a size inwhich binary tree partitioning is impossible.

The threshold value may be signaled through an upper level header of theabove-mentioned block. The threshold value should be a value between alargest size and a minimum size of a block capable of quad treepartitioning. Also, the threshold value may be set to be smaller than alargest size of a block in which binary tree partitioning is possible.When the threshold value is set to be larger than the largest size of ablock capable of binary tree partitioning, the threshold value may bechanged to a largest size of a block capable of binary treepartitioning.

FIGS. 13 a to 13 e are views illustrating an image partition methodaccording to another embodiment of the present invention.

FIG. 13 a is an enlarged view of the largest block 2, in which a portionsurrounded by a thick line is an area in the current image. The largestblock 2 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 a , the rightmost position and thebottommost position of the largest block 2 are not completely includedin the area of the current image. In this case, the block partitionscheme may be selected on the basis of the type of the remaining area.Since the remaining area in FIG. 13 a is a vertically long 46×64 block,it is possible to perform a binary tree partition in the verticaldirection for the largest block 2. That is, steps S901 to S907 for thelargest block 2 may be omitted, and step S909 or S910 may be performeddepending on the type of the remaining area.

FIG. 13 b is an enlarged view of block A0 in FIG. 13 a , in which aportion surrounded by a thick line is an area in the current image. Theblock A0 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 b , the rightmost position and thebottommost position of the block A0 are not completely contained in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 b is a vertically long 14×64 block, verticalbinary tree partitioning may be performed on the block A0. The block B0is a block in the current image area, so that the block B0 may beencoded using sub-block partitioning. Steps S905 to S908 may not beomitted for the block B0.

FIG. 13 c is an enlarged view of the block B1 in FIG. 13 b , in which aportion surrounded by a thick line is a region in the current image. Theblock B1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 c , the rightmost position and thebottommost position of the block B1 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 c is a vertically long 14×64 block, verticalbinary tree partitioning may be performed on the block B1. That is,steps S901 to S907 for block B1 may be omitted, and step S909 or S910may be performed depending on the type of the remaining area. Since theblock C2 is not completely included in the area of the current image,partitioning and encoding may be omitted.

FIG. 13 d is an enlarged view of the block C1 in FIG. 13 c , in which aportion surrounded by a thick line is a region in the current image. Theblock C1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 d , the rightmost position and thebottommost position of the block C1 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 c is a vertically long 6×64 block, verticalbinary tree partitioning may be performed on the block C1. That is,steps S901 to S907 for block C1 may be omitted, and step S909 or S910may be performed depending on the type of the remaining area. Since theblock D2 is not completely included in the area of the current image,partitioning and encoding may be omitted.

FIG. 13 e is an enlarged view of the block D1 in FIG. 13 d , in which aportion surrounded by a thick line is an area in the current image. Theblock D1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 e , the rightmost position and thebottommost position of the block D1 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 c is a vertically long 2×64 block, verticalbinary tree partitioning may be performed on the block D1. That is,steps S901 to S907 for the block D1 may be omitted, and step S909 orS910 may be performed depending on the type of the remaining area. Thewidth of the block E1 is equal to 2, which is assumed to be the minimumsize of the sub-block. Therefore, the vertical partition may not beperformed on the block E1. That is, the block E1 may be encoded withoutbeing partitioned or may be horizontally partitioned and then encoded.In this case, for the block E1, only information on whether to performpartitioning may be signaled. Since the block E2 is not completelyincluded in the area of the current image, partitioning and encoding maybe omitted.

Hereinafter, with reference to FIG. 13 a to FIG. 13 e , description willbe made on the partition method and/or the partition informationdecoding of the largest block 2 in FIG. 11 .

FIG. 13 a is an enlarged view of the largest block 2, in which a portionsurrounded by a thick line is an area in the current image. The largestblock 2 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 a , the rightmost position and thebottommost position of the largest block 2 are not completely includedin the area of the current image. In this case, the block partitionscheme may be selected on the basis of the type of the remaining area.Since the remaining area in FIG. 13 a is a vertically long 46×64 block,it is possible to perform binary tree partitioning in the verticaldirection on the largest block 2. That is, steps S1001 to S1007 for thelargest block 2 may be omitted, and step S1009 or S1010 may be performeddepending on the type of the remaining area.

FIG. 13 b is an enlarged view of the block A0 in FIG. 13 a , in which aportion surrounded by a thick line is an area in the current image. Theblock A0 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 b , the rightmost position and thebottommost position of the block A0 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 b is a vertically long 14×64 block, verticalbinary tree partitioning may be performed on the block A0. Since theblock B0 is a block in the current image area, the block B0 may bedecoded using sub-block partitioning. Steps S1005 to S1008 may not beomitted for the block B0.

FIG. 13 c is an enlarged view of the block B1 in FIG. 13 b , in which aportion surrounded by a thick line is a region in the current image. Theblock B1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 c , the rightmost position and thebottommost position of the block B1 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 c is a vertically long 14×64 block, verticalbinary tree partitioning may be performed on the block B1. That is,steps S1001 to S1007 for block B1 may be omitted, and step S1009 orS1010 may be performed depending on the type of the remaining area.Since the block C2 is not completely included in the area of the currentimage, partitioning and decoding may be omitted.

FIG. 13 d is an enlarged view of the block C1 in FIG. 13 c , in which aportion surrounded by a thick line is a region in the current image. Theblock C1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 d , the rightmost position and thebottommost position of the block C1 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 c is a vertically long 6×64 block, a verticalbinary tree partition may be performed on the block C1. That is, stepsS1001 to S1007 for the block C1 may be omitted, and step S1009 or S1010may be performed depending on the type of the remaining area. Since theblock D2 is not completely included in the area of the current image,partitioning and decoding may be omitted.

FIG. 13 e is an enlarged view of the block D1 in FIG. 13 d , in which aportion surrounded by a thick line is a region in the current image. Theblock D1 may be the partition target block described with reference toFIG. 9 . As shown in FIG. 13 e , the rightmost position and thebottommost position of the block D1 are not completely included in thearea of the current image. In this case, the block partition scheme maybe selected on the basis of the type of the remaining area. Since theremaining area in FIG. 13 c is a vertically long 2×64 block, verticalbinary tree partitioning may be performed on the block D1. That is,steps S1001 to S1007 for block D1 may be omitted, and step S1009 orS1010 may be performed depending on the type of the remaining area. Thewidth of block E1 is equal to 2, which is assumed to be the minimum sizeof the sub-block. Therefore, the vertical partition may not be performedfor the block E1. That is, the block E1 may be decoded without beingpartitioned or horizontally partitioned and then decoded. In this case,for the block E1, only information on whether to perform partitioningmay be signaled. Since block E2 is not completely included in the areaof the current image, partitioning and decoding may be omitted.

In the embodiment described with reference to FIG. 13 , only the binarytree partitioning is performed for the partition target block, and thedirection of the binary tree partition may be determined according tothe shape of the remaining area.

In the embodiment described with reference to FIGS. 9 and 10 , it ispossible to perform partition processing on a boundary of an image inunits of sub-blocks or blocks. Information on whether to performpartition processing on the boundary of the image in a certain unit maybe signaled. For example, the information may be signaled from theencoder to the decoder through an upper level header of the blockdescribed above.

As described above, for inter prediction of the current block, a skipmode, merge mode, AMVP mode, or the like may be used.

In the skip mode, the optimal prediction information of the currentblock is determined using the motion information of the area that hasbeen already reconstructed. Specifically, the image encoding apparatusconstructs a motion information candidate group within the reconstructedarea, and generates the prediction block of the current block by using acandidate having the smallest RD cost among the candidate groups asprediction information. A method of constructing the motion informationcandidate group will be described later with reference to FIG. 14 .

In the merge mode, the optimal prediction information of the currentblock is determined using the motion information of the area that hasbeen already reconstructed, which is the same as in the skip mode.However, in the case of the skip mode, the motion information issearched from the motion information candidate group so that theprediction error is zero, whereas in the merge mode, the predictionerror may not be zero. As in the case of the skip mode, the imageencoding apparatus constructs a motion information candidate group inthe reconstructed area and generates a prediction block of the currentblock using the candidate having the smallest RD cost among thecandidate groups as the prediction information.

FIG. 14 is a view illustrating a method of generating a motioninformation candidate group in the case of a skip mode and a merge mode.

The motion information candidate group may include at most N candidates.N may be a predetermined positive integer in the image encodingapparatus and the image decoding apparatus. Alternatively, informationon N may be signaled via the bitstream. For example, information on Nmay be signaled through an upper level header of the block. The upperlevel of the block may be at least one of a video, a sequence, apicture, a slice, a tile, a coding tree unit (CTU), or a largest codingunit (LCU). Alternatively, N may be variably determined on the basis ofon the size and/or shape of the current block. In the followingembodiments described with reference to FIG. 14 , N is assumed to be 5.

In step S1401, a spatial candidate may be selected. A spatial candidatemay refer to a spatial candidate block in the picture to which thecurrent block belongs or motion information of the spatial candidateblock. Up to four spatial candidates may be selected from the fivespatial candidate blocks in the current picture. When the spatialcandidate block does not include motion information, for example, whenthe spatial candidate block is intra-predicted or PCM-encoded, thespatial candidate block may not be selected as a spatial candidate ofthe current block. Also, spatial candidates may be selected such thatthe motion information does not overlap.

FIG. 16 is a view illustrating positions of spatial candidate blocks andtemporal candidate blocks in the current block.

In the example shown in FIG. 16 , the spatial candidate block mayinclude at least one of the blocks A1, A2, A3, A4, and A5. In additionto the spatial candidate blocks shown in FIG. 16 , an arbitrary block inthe reconstructed region of the current picture may be used as a spatialcandidate block. When selecting spatial candidates from spatialcandidate blocks, blocks A1, A2, A3, A4, and A5 may be considered inthis order. According to the priority, an available spatial candidateblock or motion information thereof may be selected as a spatialcandidate. When the motion information of the available spatialcandidate blocks is not overlapped, the spatial candidate block with thelowest priority may not be considered.

In step S1402, a temporal candidate may be selected. The temporalcandidate may refer to a temporal candidate block in a picture otherthan the picture to which the current block belongs (e.g., collocatedpicture) or motion information of the temporal candidate block. Onetemporal candidate may be selected from two temporal candidate blocks inthe collocated picture. When the temporal candidate block does notinclude motion information, for example, when the temporal candidateblock is intra-predicted or PCM-encoded, the temporal candidate blockmay not be selected as the temporal candidate of the current block.

As shown in FIG. 16 , the positions of the temporal candidate blocks maybe determined on the basis of the position of the current block. Thatis, the temporal candidate blocks may be determined on the basis of theblock in the collocated picture at the same position as the currentblock in the current picture. The collocated picture may be one of areconstructed picture or a reference picture. The collocated picture maybe selected in the image encoding apparatus and the image decodingapparatus in a predetermined manner. For example, a reference picture ofany location (e.g., first location) in the reference picture list may beselected as the collocated picture. Alternatively, information on theselection of the collocated picture may be signaled.

The temporal candidate block may be a block in a collocated picture or aneighboring block thereof, which includes a sample at the same positionas an arbitrary position in the current block. An arbitrary position inthe current block may be the upper left pixel position, the center pixelposition, or the lower right pixel position of the current block. In theexample shown in FIG. 16 , the temporal candidate blocks in thecollocated picture may be blocks B1 and B2. When a temporal candidate isselected from the temporal candidate blocks, for example, blocks B1 andB2 may be considered in this order. Considering the blocks B1 and B2according to the above order, when a temporal candidate block havinghigher priority is available as a temporal candidate, a temporalcandidate block having lower priority may not be considered.

FIG. 17 is a view illustrating a method of determining motioninformation of a temporal candidate.

The motion information of the temporal candidate block in the collocatedpicture may indicate a prediction block in the reference picture B. Eachof the temporal candidate blocks may refer to a different referencepicture. In the following description, the reference picture of thetemporal candidate block is referred to as a reference picture B forconvenience. The motion vector of the temporal candidate block may bescaled considering TB and TD in FIG. 17 . TB denotes the distancebetween the current picture and the reference picture A, and TD denotesthe distance between the collocated picture and the reference picture B.The motion vector of the scaled temporal candidate may be used as themotion information of the temporal candidate of the current block.Equation 2 below may be used for the scaling.

$\begin{matrix}{{MV}_{scale} = {\left( {{\left( {\left( {{{TB} \times \frac{2^{14} + \left( {{TD} \gg 1} \right)}{TD}} + 2^{5}} \right) \gg 6} \right) \times {MV}} + \left( {2^{7} - 1} \right)} \right) \gg 2^{3}}} & \left\lbrack {{Equation}2} \right\rbrack\end{matrix}$

In Equation 2, MV indicates a motion vector of the temporal candidateblock, and MVscale indicates a scaled motion vector. Also, the referencepicture A and the reference picture B may be the same reference picture.The scaled motion vector MVscale may be determined as a motion vector ofthe temporal candidate. Also, the reference picture information of thetemporal candidate may be determined as the reference picture of thecurrent picture.

Step S1403 may be performed when the sum of the spatial candidates andthe temporal candidates derived in steps S1401 and S1402 is less than N.In step S1403, candidates derived in the previous step may be combinedto add a new bidirectional motion information candidate to the motioninformation candidate group. The bidirectional motion informationcandidates are referred to as candidates combined and newly generated byfetching the past and future motion information derived from theprevious step one by one.

FIG. 18 is an exemplary table illustrating a priority of a combinationcapable of being used to generate bidirectional motion informationcandidates. For example, the combination of the candidate index (past) 0and the candidate index (future) 1 may be first considered firstaccording to the priority shown in FIG. 18 . The combination of thepriority and index shown in FIG. 18 is illustrative, but the presentinvention is not limited thereto. For example, an additional combinationother than the combination shown in FIG. 18 is possible, or change ofthe priority is possible.

In step S1403, when the bidirectional motion information candidate isadded but the total number of motion information candidates is less thanN, step S1404 may be performed. In step S1404, the motion vector is azero motion vector, and a new motion information candidate havingdifferent reference picture according to the prediction direction may beadded to the motion information candidate group.

In the case of AMVP mode, optimal motion information may be determinedby performing motion estimation for each reference picture according toa prediction direction. The prediction direction may be unidirectionalusing only one of the past/future directions, or both directions usingboth the past and future directions. A prediction block may be generatedby performing motion compensation using optimal motion informationdetermined through motion prediction. Here, a motion informationcandidate group for motion estimation may be derived for each referencepicture according to the prediction direction. The motion informationcandidate group may be used as a starting point of motion estimation.

In the present specification, the prediction direction is described asthe past direction and the future direction, but the present inventionis not limited thereto. For example, it may be expressed as forward andbackward or in a first direction and a second direction. For example,when N reference picture lists are used for a current block, predictiondirections corresponding to the number of reference picture lists mayexist. In this case, the prediction direction may be expressed in thefirst direction to the Nth direction. The N may be an integer of 2 ormore.

FIG. 15 is a view illustrating a method of deriving a motion informationcandidate group for motion estimation in an AMVP mode.

Similar to the case described with reference to FIG. 15 , the largestnumber of candidates that may be included in the motion informationcandidate group may be determined equally in the image encodingapparatus and the image decoding apparatus, or may be signaled throughthe upper level header of the block, and may be variably determined onthe basis of the size and/or shape of the current block.

In steps S1501 and S1502, a spatial candidate and a temporal candidateis selected. Each of steps S1501 and S1502 may be performed similarly tosteps S1401 and S1402 in FIG. 14 . However, unlike in step S1401, instep S1501, the number of selected spatial candidates may be changed.For example, in step S1501, two spatial candidates may be selected. Inaddition, the priority among spatial candidate blocks for selecting aspatial candidate may also be different.

In step S1503, when there is overlapped motion information among thecandidates derived up to now, it may be removed. Step S1504 may beperformed similarly to step S1404. When the motion informationcandidates are derived, the motion information candidate having minimumRD cost may be selected as the optimal motion information candidate. Byperforming motion estimation on the basis of the selected motioninformation, optimal motion information of the AMVP mode may be derived.

The intra prediction mode for performing intra prediction describedabove may include a DC mode, a planar mode, and N directional modes. TheN directional mode is a mode for generating a prediction block of thecurrent block by partitioning the reconstructed pixels around thecurrent block into N directions and mapping neighboring pixels to thepredicted pixel for each direction. Once the optimal intra predictionmode is determined, an MPM candidate list may be generated to encode thesame.

FIG. 19 is a view illustrating generation of an MPM candidate list.

The number of MPM candidate lists may be determined to be P (P is apositive integer). The method of determining the MPM candidate is notlimited to the method described with reference to FIG. 19 . In FIG. 19 ,L is the intra prediction mode information of the neighboring blocklocated on the left side of the current block, and A is the intraprediction mode information of the neighboring block located on the topof the current block. According to each condition shown in FIG. 19 , anMPM candidate list including three MPM candidates may be generated.

FIG. 20 is a view illustrating a method of encoding the optimalprediction information of skip mode, merge mode, AMVP mode, and intraprediction mode.

In step S2001, skip mode operation information may be encoded. The skipmode operation information may be information indicating whether or notthe skip mode is applied to the current block. In step S2002, on thebasis of the skip mode operation information, it may be determinedwhether or not it is a skip mode. In the case of the skip mode (Yes instep S2002), the process proceeds to step S2007 so that the mergecandidate index is encoded, and the process is ended.

When it is not the skip mode (No in step S2002), prediction modeinformation may be encoded in step S2003. The prediction modeinformation may be information indicating whether inter prediction orintra prediction is performed for the current block. In step S2004, itmay be determined whether the prediction mode for the current block isthe inter prediction mode or the intra prediction mode on the basis ofthe prediction mode information. When the prediction mode of the currentblock is the inter prediction mode (Yes in step S2004), the processproceeds to step S2005. When the prediction mode of the current block isintra prediction mode (No in step S2004), the process proceeds to stepS2017.

In step S2005, the merge mode operation information may be encoded. Themerge mode operation information may be information indicating whetherthe merge mode is applied to the current block. In step S2006, it may bedetermined whether or not the merge mode is applied to the current blockon the basis of the merge mode operation information. When the mergemode is applied to the current block (Yes in step S2006), the mergecandidate index may be encoded in step S2007, and the process is ended.

When the merge mode is not applied to the current block in step S2006,the process proceeds to step S2008. In step S2008, whether theprediction direction is past, future, or bi-directional may be encoded.In step S2009, when the prediction direction is not the futuredirection, step S2010 may be performed. When the prediction direction isthe future direction, step S2013 may be performed.

The reference picture index information in the past direction in stepS2010, motion vector difference (MVD) information in the past directionin step S2011, and motion vector predictor (MVP) information in the pastdirection in step S2012 are encoded in this order. Here, MVD may mean adifference vector between the optimal motion vector of the predictionblock and candidate motion vector optimally determined of the AMVPcandidate list. Also, the MVP information may indicate index informationof the AMVP candidate motion information that is determined to beoptimum.

In step S2013, it is determined whether the prediction direction is thepast direction, and when the direction is the past direction, theprocess of FIG. 20 may be ended. In step S2013, when the predictiondirection is not the past direction, step S2014 may be performed.Reference picture index information in the future direction in stepS2014, future direction MVD information in step S2015, and futuredirection MVP information in step S2016 may be encoded in this order.

When the intra prediction is applied to the current block (No in stepS2004), MPM flag information may be encoded in step S2017. The MPM flaginformation may be information indicating whether the optimal intraprediction mode of the current block belongs to the MPM candidate list.In step S2018, it may be determined whether or not the MPM flaginformation is true. When the MPM flag information is true (Yes in stepS2018), step S2019 may be performed. In step S2019, it is possible toencode index information indicating to which candidate the optimal intraprediction mode is identical out of the MPM candidate lists.

In step S2018, when the MPM flag information is false, step S2020 may beperformed. In step S2020, it is possible to encode informationindicating which intra prediction mode is the optimal intra predictionmode out of the remaining intra prediction modes except the intraprediction modes belonging to the MPM candidate list.

FIG. 21 is a view illustrating a method of decoding optimal predictioninformation.

In step S2101, the skip mode operation information may be decoded. Instep S2102, on the basis of the skip mode operation information, it maybe determined whether or not it is a skip mode. In the case of skip mode(Yes in step S2102), the process proceeds to step S2107 so that themerge candidate index is decoded, and the process is ended.

In the case of not a skip mode (No in step S2102), prediction modeinformation may be decoded in step S2103. In step S2104, it may bedetermined whether the prediction mode for the current block is theinter prediction mode or the intra prediction mode on the basis of theprediction mode information. When the prediction mode of the currentblock is the inter prediction mode (Yes in step S2104), the processproceeds to step S2105. When the prediction mode of the current block isintra prediction mode (No in step S2104), the process proceeds to stepS2117.

In step S2105, the merge mode operation information may be decoded. Instep S2106, on the basis of the merge mode operation information, it maybe determined whether or not the merge mode is applied to the currentblock. When the merge mode is applied to the current block (Yes in stepS2106), the merge candidate index may be decoded in step S2107, and theprocess is ended.

When the merge mode is not applied to the current block in step S2106,the process may proceed to step S2108. In step S2108, it is possible todecode whether the prediction direction is past, future, orbi-directional. In step S2109, when the prediction direction is not thefuture direction, step S2110 may be performed. When the predictiondirection is the future direction, step S2113 may be performed.

Reference picture index information in the past direction in step S2110,MVD information in the past direction in step S2111, and MVP informationin the past direction are decoded in this order.

In step S2113, it is determined whether the prediction direction is thepast direction, and when the direction is the past direction, theprocess of FIG. 21 may be ended. In step S2113, when the predictiondirection is not the past direction, step S2114 may be performed. Instep S2114, reference picture index information in the future direction,future direction MVD information in step S2115, and future direction MVPinformation in step S2116 may be decoded in this order.

When intra prediction is applied to the current block (No in stepS2104), MPM flag information may be decoded in step S2117. In stepS2118, it may be determined whether or not the MPM flag information istrue. When the MPM flag information is true (Yes in step S2118), stepS2119 may be performed. In step S2119, it is possible to decode indexinformation indicating to which candidate the optimal intra predictionmode is identical out of the MPM candidate lists.

In step S2118, when the MPM flag information is false, step S2120 may beperformed. In step S2120, it is possible to decode informationindicating which intra prediction mode is the optimal intra predictionmode out of the remaining intra prediction modes except the intraprediction modes belonging to the MPM candidate list.

Hereinafter, various embodiments in which prediction information of aneighboring block of a current block is used for encoding/decodingprediction information to generate prediction block will be described.

When a block is partitioned by binary tree partitioning, the predictioninformation of specific blocks around the current block may not beutilized. That is, when constructing MPM candidate list in the case ofintra prediction, or when deriving skip, merge or AMVP spatialcandidates in the case of inter prediction, considering the partitionstructure of the block, some of neighboring blocks of the current blockneighboring blocks may be excluded from the candidate. Hereinafter, thecandidate list including the intra prediction MPM candidate list or theinter prediction spatial candidate is referred to as a “referencecandidate list”.

FIG. 22 is a view illustrating an embodiment of constructing a referencecandidate list using neighboring blocks of the current block.

In step S2201, whether the partition type of the upper level block ofthe current block is a binary tree partition may be determined. That is,in step S2201, whether the current block is a block generated by thebinary tree partition may be determined. When the partition type of theupper level block is not a binary tree partition, it is determined thatthere are no neighboring blocks that are excluded in the constructing ofthe reference candidate list, and the process of FIG. 22 may be ended.When the partition type of the upper level block is a binary treepartition, that is, when the current block is a block generated bybinary tree partitioning, step S2202 may be performed.

In step S2202, it may be determined whether or not the depth of thecurrent block and the depth of the immediately preceding block are thesame, and whether the current block and the upper level block of theimmediately preceding block are the same. The immediately precedingblock means a block in which encoding/decoding is completed immediatelybefore the current block in the coding order. The upper level blockmeans a block before being partitioned into the current block or theimmediately preceding block. Conversely, a lower level block may referto a block generated by partitioning a current block. When the depth ofthe current block is different from the depth of the immediatelypreceding block and/or when an upper level block of the current block isdifferent from an upper level block of the immediately preceding block,the processing of FIG. 22 may be ended. That is, in the case of No instep S2202, available neighboring blocks may be added as a candidate tothe reference candidate list without neighboring blocks excludedaccording to the present embodiment when constructing the referencecandidate list.

In step S2202, when the current block and the immediately precedingblock have the same partition depth, and an upper level block of thecurrent block and an upper level block of the previous block are thesame to each other, the immediately preceding block is not included as acandidate in the reference block list of the current block or excludedfrom the reference candidate list (step S2203). When the upper levelblock is partitioned by binary tree partitioning into the current blockand the immediately preceding block, there is a high likelihood that thecurrent block and the immediately preceding block are the same to eachother. In this case, there is a low likelihood that the predictioninformation of the immediately preceding block is used as the predictioninformation of the current block. Therefore, even the neighboring blockof the current block is excluded from the candidate block of the currentblock, and accordingly the prediction efficiency and the compressionratio may be improved.

In step S2203, when the immediately preceding block is not included inthe reference candidate list, a replacement candidate for replacing thereference candidate excluded in step S2204 may be additionally searched.

FIG. 23 is a view illustrating an example of constructing a referencecandidate list of a current block on the basis of a partition type of ablock.

In the example shown in (a) of FIG. 23 , when the current block is ablock 4, the immediately preceding block is a block 3 in the encodingorder. In addition, the current block and the upper level block of theimmediately preceding block are blocks including the blocks 3 and 4. Theupper level block including the blocks 3 and 4 is partitioned byhorizontal binary tree partitioning, so that the determination result ofstep S2201 is Yes. In addition, since the partition depths of the blocks3 and 4 are the same, and the depth of the upper level block is also thesame, the determination result of step S2202 is Yes. Therefore, inaccordance with step S2203, the block 3, which is the immediatelypreceding block, is not included in the reference candidate list of thecurrent block.

Similarly, in the example shown in (a) of FIG. 23 , when the currentblock is block 7, block 6, which is the immediately preceding block ofthe current block, is excluded from the reference candidate list of thecurrent block. In addition, in the example shown in (b) of FIG. 23 ,when the current block is a block 11, the prediction information of ablock 10, which is the immediately preceding block, is not considered asa reference block of the current block.

As described with reference to the example shown in (a) and (b) of FIG.23 , when the immediately preceding block of the current block is notconsidered as a reference candidate, another candidate may be searchedto substitute the prediction information of a neighboring block excludedfrom the reference candidate list (S2204). The substitute candidate maybe determined by various methods. For example, prediction information ofa block that is not adjacent to a current block may be used among blockspartitioned from a block of an upper level depth of the current block.For example, in the example shown in (a) of FIG. 23 , when the currentblock is a block 4, a block of an upper level depth of the block 4 maybe a combination of the blocks 2, 3, and 4. In this case, since theblock 2 is a block partitioned from a block of an upper level depthwithout being adjacent to the block 4, the prediction information of theblock 2 instead of the prediction information of the block 3 may beadded to the reference candidate list of the block 4. As another examplefor determining a replacement candidate, arbitrary predictioninformation determined in an upper level header (video, sequence,picture, slice, tile, CTU, etc.) may be used instead of the predictioninformation of neighboring blocks excluded from the reference candidatelist. For example, when the current block is predicted in intraprediction mode, the arbitrary prediction information may be apredetermined intra prediction mode (for example, planar mode or DCmode). For example, when the current block is predicted in the interprediction mode, the arbitrary prediction information may bepredetermined prediction information (e.g., {(0,0) motion vector,reference picture index 0, past direction). Alternatively, step S2204may not be performed and the alternative candidate may not be searched.

Even when the current block is a block generated by quad treepartitioning, prediction information of specific blocks around thecurrent block may not be utilized.

FIG. 24 is a view illustrating another embodiment for constructing areference candidate list using neighboring blocks of the current block.

FIG. 25 is a view illustrating another embodiment for constructing areference candidate list of a current block on the basis of a type of ablock partition.

In step S2401, whether the partition type of the upper level block ofthe current block is a quad tree partition may be determined. That is,in step S2401, whether the current block is a block generated by quadtree partitioning may be determined. When the partition type of theupper level block is not a quad tree partition, it is determined thatthere is no neighboring block that is excluded in the constructing ofthe reference candidate list, and the processing of FIG. 24 may beended. When the partition type of the upper level block is a quad treepartition, that is, when the current block is a block generated by quadtree partitioning, step S2402 may be performed.

In step S2402, whether the current block is the last sub-block in theencoding order among four sub-blocks generated by quad tree partitioningmay be determined. The last sub-block may be a sub-block D in theexample shown in FIG. 25 . When the current block is not the sub-blockD, it is determined that there is no neighboring block that is excludedin the constructing of the reference candidate list, and the processingof FIG. 24 may be ended. When the current block is the sub-block D, stepS2403 may be performed.

In step S2403, whether the prediction information of sub-blocks A, B,and C in FIG. 25 are all the same may be determined. When the predictioninformation of the sub-blocks A, B, and C is not all the same, it isdetermined that there is no neighboring block that is excluded in theconstructing of the reference candidate list, and the process of FIG. 24may be ended. When the prediction information of the sub-block A, B, andC are all the same, in step S2404, when constructing the referencecandidate list of the sub-block D that is the current block, theprediction information of the sub-blocks A, B, and C may be excludedfrom the reference candidate list. When an upper level block ispartitioned into four sub-blocks by quad tree partitioning, then atleast one sub-block of the four sub-blocks is likely not similar to theremaining sub-blocks. In this case, there is a low likelihood that theprediction information of sub-blocks that are not similar to each otheris used as prediction information of the current block. For example, inthe example shown in FIG. 25 , when the prediction information of thesub-blocks A, B, and C is the same, there is a high likelihood that theprediction information of the sub-block D is not the same as or similarto the prediction information of the sub-blocks A, B, and C. Therefore,even in the case of neighboring blocks of the current block, thesub-blocks A, B, and C are excluded from the candidate group of thesub-block D, whereby prediction efficiency and the compression ratio maybe improved.

In step S2405, a candidate for substituting the excluded referencecandidate may be searched. The substitute candidate may be determined byvarious methods. For example, as described above, predeterminedprediction information (DC or planar mode for intra prediction mode,zero motion information for inter prediction mode, etc.) may be used. Asanother example, among the blocks not adjacent to the current block,prediction information of the most recently encoded block preceding thecurrent block may be used. Alternatively, step S2405 may be omitted.

FIG. 26 is a view illustrating a method of changing the priority ofneighboring blocks of the current block included in the referencecandidate list.

In the embodiment described with reference to FIG. 26 , it is possibleto adaptively determine the priority of available neighboring blocks ofthe current block when constructing the reference candidate list of thecurrent block.

According to the first method of the present invention, priorities maybe determined on the basis of whether the current block is adjacent tothe neighboring block and/or the position of the neighboring block. Forexample, a higher priority may be given to a neighboring block that isadjacent to the current block, and a lower priority may be given to aneighboring block that is not adjacent to the current block. In theexample shown in FIG. 26 , the neighboring blocks A, B, F, and G areblocks adjacent to the current block. Therefore, the neighboring blocksA, B, F, and G may be given a high priority. Also, the priority amongadjacent neighboring blocks may be determined according to apredetermined method. For example, a block at a particular position maybe given a high priority. The particular location may be, for example,the left and/or top of the current block. According to such criterion,the priority of the neighboring blocks shown in FIG. 26 may bedetermined in the order of blocks A→B→F→G→C→D→E. Conversely, a lowpriority may be given to a block adjacent to the current block, and ahigh priority may be given to a block not adjacent to the current block.In this case, the priority may be determined in the order of blocksC→D→E→A→B→F→G.

According to the second method of the present invention, the prioritymay be changed on the basis of the block partition depth information ofthe current block and the neighboring block. For example, priority maybe given on the basis of the degree of similarity between the partitiondepth of the current block and the partition depth of the neighboringblock. For example, a neighboring block having a partition depth similarto that of the current block may be given a higher priority. Thepriority may be given to neighboring blocks of the same partition depthon an arbitrary basis. For example, a neighboring block at a specificlocation, such as the left or top of a current block, may be given ahigh priority.

FIG. 27 is a view illustrating a method of determining a priority ofneighboring blocks on the basis of the partition depth.

In an example shown in FIG. 27 , the partition depth of the currentblock is X, the partition depth of the neighboring blocks A and F is X,the partition depth of neighboring blocks B and G is X+1, the partitiondepth of neighboring blocks D and E is X+2, and the partition depth ofneighboring block C is X+3. According to the second method according tothe present invention, a neighboring block having a partition depthsimilar to the partition depth of the current block is given a highpriority in consideration of the partition depth of the current block,so that the priority may be determined in the order of blocksA→F→G→B→D→E→C. Alternatively, without considering the partition depth ofthe current block, the higher the partition depth of the neighboringblocks, the higher the priority may be given. For example, the priorityof neighboring blocks considering only the partition depth ofneighboring blocks may be determined in the order of blocksC→D→E→A→F→G→B. Alternatively, a lower priority may be given to aneighboring block having the partition depth similar to that of thecurrent block, or the lower the partition depth of the neighboringblocks, the higher the priority may be given.

According to the third method of the present invention, the priority ofneighboring blocks may be determined on the basis of the partition orderof the blocks. For example, a neighboring block that is most recentlypartitioned and encoded/decoded on the basis of the current block may begiven a high priority. FIG. 28 is a view illustrating a method ofprioritizing neighboring blocks on the basis of a partition order. Inthe example shown in FIG. 28 , the partition order of neighboring blocksis indicated at the boundaries between blocks. According to the exampleshown in FIG. 28 , the priority of neighboring blocks considering thepartition order of neighboring blocks may be determined in order ofblocks E→B→C→F→A→D. Alternatively, a low priority may be given to aneighboring block that has been most recently partitioned andencoded/decoded on the basis of the current block.

According to the fourth method of the present invention, the priority ofthe neighboring blocks may be determined on the basis of the causalrelationship of the prediction information between neighboring blocks.For example, when the first neighboring block of the current block isencoded/decoded using prediction information of another secondneighboring block, the first neighboring block may be given a lowpriority. FIG. 29 is a view illustrating a method of determining thepriority of neighboring blocks on the basis of casual relationship ofprediction information. In FIG. 29 , (a) shows the location of currentblock and neighboring blocks. In FIG. 29 , (b) shows predictioninformation of each neighboring block. According to the example shown inFIG. 29 , the prediction information is determined with reference to theprediction information of the block G in the block B. Similarly,prediction information is determined by referring to the predictioninformation of the block B, the prediction information of the block A,and the prediction information of the block G and the block E in theblock C and the block B, respectively. That is, for example, since theprediction information of the block B is determined on the basis theprediction information of the block G, it may be said that there is acausal relationship between the prediction information of the block Gand the prediction information of the block B. In the example shown in(a) of FIG. 29 , the priority of the neighboring blocks may be in anyorder, for example, in an order of blocks A→B→C→D→E→F→G. The prioritymay be changed in consideration of the causal relationship between thepredicted information. For example, since the blocks B, C, D, and G areencoded/decoded referring to prediction information of other neighboringblocks, low priority may be given thereto. Finally, the priorities ofthe neighboring blocks considering the causality between the predictionsof the neighboring blocks may be determined in order of blocksA→E→F→B→C→D→G. Alternatively, when the first neighboring block refers tothe prediction information of the second neighboring block, the secondneighboring block may be given a lower priority.

In the above, four methods for determining the priority of theneighboring blocks when constructing the reference candidate list usingthe neighboring blocks of the current block have been described. Thefirst to fourth methods may be applied independently. Alternatively atleast two or more of the first to fourth methods may be applied incombination. For example, by applying the second method and the thirdmethod simultaneously, the priority of the neighboring blocks for theconfiguring of the reference candidate list may be determined. FIG. 30is a view illustrating a method of determining the priority ofneighboring blocks considering both partition depth and partition order.FIG. 30 shows the partition depths (X, X+1, X+2, X+3) and partitionorders (1 to 5) of neighboring blocks. There are various methods inwhich the second method and the third method are simultaneously applied.For example, a neighboring block with a partition depth similar to thatof the current block may be given a high priority, and a neighboringblock with a fast partition order may be given a high priority. In thiscase, it is possible to first arrange the priority on the basis of thepartition order. In the example shown in FIG. 30 , on the basis of thepartition order, it may be first arranged in the order of blocksE→G→B→C→F→A→D. Thereafter, a neighboring block with a partition depthsimilar to the partition depth of the current block may be given ahigher priority. For example, since the partition depth (X+1) of theblock G is more similar to the partition depth (X) of the current blockthan the partition depth (X+2) of the block E, the priority is arrangedin the order of G→E→B→C→F→A→D. Since the partition depth (X) of theblocks A and F is more similar to the partition depth (X) of the currentblock than the partition depth (X+3) of the block C, the priority isarranged in the order of E→G→B→F→A→C→D. The priority of the neighboringblock for the reference candidate list of the current block may bedetermined by applying two or more criteria as described above.

Although the exemplary methods of this disclosure are represented by aseries of acts for clarity of explanation, they are not intended tolimit the order in which the steps are performed, and if necessary, eachstep may be performed simultaneously or in a different order. In orderto implement the method according to the present disclosure, theillustrative steps may additionally include other steps, include theremaining steps except for some steps, or may include additional stepsother than some steps.

The various embodiments of the present disclosure are not intended to beall-inclusive and are intended to be illustrative of the typical aspectsof the present disclosure, and those described in the variousembodiments may be applied independently or in a combination of two ormore.

Furthermore, various embodiments of the present disclosure may beimplemented by hardware, firmware, software, or a combination thereof.The hardware may be implemented by one or more application specificintegrated circuits (ASICs), digital signal processors (DSPs), digitalsignal processing devices (DSPDs), programmable logic devices (PLDs),field programmable gate arrays (FPGAs), a general processor, acontroller, a microcontroller, a microprocessor, and the like.

The scope of the present disclosure includes software ormachine-executable instructions (e.g., operating system, applications,firmware, programs, etc.) that cause operations in accordance withmethods of the various embodiments to be performed on a device orcomputer, and non-transitory computer-readable medium executable on thedevice or computer in which such software or instructions is stored.

INDUSTRIAL APPLICABILITY

The present invention may be used to encode/decode an image.

1. A video decoding method comprising: determining a partition type ofan upper block including a current block; deriving a reference candidatelist for the current block based on the partition type of the upperblock; deriving prediction information of the current block based on thereference candidate list; and generating a prediction block of thecurrent block based on the prediction information, wherein the referencecandidate list includes at least one candidate block, wherein, when theupper block includes a neighboring block adjacent to the current block,the reference candidate list for the current block includes a candidateblock adjacent to the neighboring block but not to the current block,and wherein, when the upper block includes a neighboring block adjacentto the current block, the reference candidate list for the current blockdoes not include the neighboring block as a candidate block.
 2. A videoencoding method comprising: determining a partition type of an upperblock including a current block; deriving a reference candidate list forthe current block based on the partition type of the upper block;generating a prediction block of the current block based on thereference candidate list; and encoding prediction information of thecurrent block based on the prediction block, wherein the referencecandidate list includes at least one candidate block, wherein, when theupper block includes a neighboring block adjacent to the current block,the reference candidate list for the current block includes a candidateblock adjacent to the neighboring block but not to the current block,and wherein, when the upper block includes a neighboring block adjacentto the current block, the reference candidate list for the current blockdoes not include the neighboring block as a candidate block.
 3. Anon-transitory computer-readable recording medium storing a bitstreamgenerated by a video encoding method with a video encoding apparatus,the video encoding method comprises: determining a partition type of anupper block including a current block; deriving a reference candidatelist for the current block based on the partition type of the upperblock; generating a prediction block of the current block based on thereference candidate list; and encoding prediction information of thecurrent block based on the prediction block into a bitstream, whereinthe reference candidate list includes at least one candidate block,wherein, when the upper block includes a neighboring block adjacent tothe current block, the reference candidate list for the current blockincludes a candidate block adjacent to the neighboring block but not tothe current block, and wherein, when the upper block includes aneighboring block adjacent to the current block, the reference candidatelist for the current block does not include the neighboring block as acandidate block.